package com.hlbspringcloud.contentcenter.controller.content;

import com.hlbspringcloud.contentcenter.domain.dto.content.ShareDTO;
import com.hlbspringcloud.contentcenter.domain.dto.uer.UserDTO;
import com.hlbspringcloud.contentcenter.feignclient.TestUserCenterFeignClient;
import com.hlbspringcloud.contentcenter.service.content.ShareService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: share控制器
 * @PROJECT_NAME: spring-cloud-alibaba
 * @CLASS_NAME:
 * @Author: huanglibin
 * @Date: 2020-05-24 3:28
 * @Version: 1.0
 */
@RestController
@RequestMapping("/shares")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ShareController {

    private final ShareService shareService;

    /**
     * 根据id查询内容详情
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public ShareDTO findById(@PathVariable Integer id){
        return this.shareService.findById(id);
    }

    @Autowired
    private TestUserCenterFeignClient testUserCenterFeignClient;

    @GetMapping("/getUser")
    public UserDTO getUser(UserDTO userDTO){
        return testUserCenterFeignClient.getUser(userDTO);
    }
}
